<html>
<head><meta charset="utf-8"><title>An unsafe mystery with SIMD · t-lang/wg-unsafe-code-guidelines · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/index.html">t-lang/wg-unsafe-code-guidelines</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html">An unsafe mystery with SIMD</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="219343084"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219343084" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219343084">(Dec 09 2020 at 14:31)</a>:</h4>
<p>I've encountered something with some <code>unsafe</code> SIMD code which either feels like I'm doing something profoundly and subtly wrong, or it's a compiler bug and I'm not sure which.</p>
<p>The usage is what feels like some pretty straightforward usage of <code>target_feature(enable = "avx2"</code>, works locally, but with this change alone goes from all tests passing to miscomputing a result, 100% reproducibly in CI (GitHub Actions):</p>
<p><a href="https://github.com/RustCrypto/universal-hashes/commit/62efb8e751d5105845a0e2e6481a2c7fb64e1ab5">https://github.com/RustCrypto/universal-hashes/commit/62efb8e751d5105845a0e2e6481a2c7fb64e1ab5</a></p>



<a name="219343126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219343126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219343126">(Dec 09 2020 at 14:31)</a>:</h4>
<p>as it's a cryptography application, miscomputing results is mildly terrifying</p>



<a name="219354715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219354715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219354715">(Dec 09 2020 at 15:49)</a>:</h4>
<p>It may very well be that avx2 is not supported by the processors used for Github Actions. You should always guard a call to a <code>#[target_feature(enable = "...")]</code> function with a <code>is_x86_feature_detected!</code> check.</p>



<a name="219355427"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219355427" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219355427">(Dec 09 2020 at 15:54)</a>:</h4>
<p>I was once bitten by something similar: <a href="https://github.com/bytecodealliance/wasmtime/issues/1448">bytecodealliance/wasmtime#1448</a> Here the the <code>clz</code> instruction compiles to <code>bsr</code> + some extra instructions when <code>lzcnt</code> is unavailable, but to <code>lzcnt</code> when it is available. As it so happens, <code>lzcnt</code> is encoded as <code>bsr</code> with a prefix that is normally ignored. Because the macOS builders don't support <code>lzcnt</code>, I suddenly got incorrect results when enabling <code>lzcnt</code> through the <code>haswell</code> preset.</p>



<a name="219357666"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219357666" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219357666">(Dec 09 2020 at 16:08)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> we're using something similar to <code>is_x86_feature_detected!</code>: <a href="https://docs.rs/cpuid-bool/">https://docs.rs/cpuid-bool/</a></p>



<a name="219357767"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219357767" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219357767">(Dec 09 2020 at 16:09)</a>:</h4>
<p>I don't see it used in the test.</p>



<a name="219358012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219358012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219358012">(Dec 09 2020 at 16:10)</a>:</h4>
<p>aha!</p>



<a name="219358043"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219358043" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219358043">(Dec 09 2020 at 16:10)</a>:</h4>
<p>gooooood catch, heh</p>



<a name="219361241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219361241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219361241">(Dec 09 2020 at 16:30)</a>:</h4>
<p>hrmm, still getting test failures <span aria-label="cry" class="emoji emoji-1f622" role="img" title="cry">:cry:</span> and these should be going via the autodetection path</p>



<a name="219371378"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219371378" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219371378">(Dec 09 2020 at 17:43)</a>:</h4>
<p>alright, just reproduced a minimal change that breaks the normal tests (which should always take the autodetection path in theory)</p>



<a name="219372745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219372745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219372745">(Dec 09 2020 at 17:54)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> really weird, right? and unfortunately not reproducible at all locally</p>



<a name="219372812"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219372812" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219372812">(Dec 09 2020 at 17:55)</a>:</h4>
<p>locally everything looks great and I'm getting only slightly slower performance with CPUID detection as I am by passing <code>RUSTFLAGS</code></p>



<a name="219373132"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219373132" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219373132">(Dec 09 2020 at 17:57)</a>:</h4>
<p>Yeah, very weird. Could you print the internal state at each operation and compare CI with your local results? Maybe that will help pinpoint the location of the bug.</p>



<a name="219373240"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219373240" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219373240">(Dec 09 2020 at 17:58)</a>:</h4>
<p>sure, sounds good</p>



<a name="219376660"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219376660" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219376660">(Dec 09 2020 at 18:21)</a>:</h4>
<p>uhhhh wow</p>



<a name="219376779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219376779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219376779">(Dec 09 2020 at 18:22)</a>:</h4>
<p>I need to double check exactly what I changed that did it, but I tried to scope the tests down and now they pass</p>



<a name="219377941"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219377941" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219377941">(Dec 09 2020 at 18:31)</a>:</h4>
<p>yeah this is <em>really</em> starting to feel like a compiler bug</p>



<a name="219377995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219377995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219377995">(Dec 09 2020 at 18:31)</a>:</h4>
<p>Fails: no RUSTFLAGS, <code>--release</code></p>



<a name="219378019"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219378019" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219378019">(Dec 09 2020 at 18:31)</a>:</h4>
<p>Succeeds: no <code>--release</code> or <code>RUSTFLAGS="-Ctarget-cpu=haswell" cargo test ... --release</code></p>



<a name="219379000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219379000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219379000">(Dec 09 2020 at 18:38)</a>:</h4>
<p>the internal state is the same. it's failing while computing the output from the internal state</p>



<a name="219380238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219380238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219380238">(Dec 09 2020 at 18:48)</a>:</h4>
<p>narrowed it down to one of the reduction functions...</p>



<a name="219382656"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219382656" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219382656">(Dec 09 2020 at 19:05)</a>:</h4>
<p>so as far as I can tell a value being returned from a lambda is being corrupted</p>



<a name="219383170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219383170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219383170">(Dec 09 2020 at 19:09)</a>:</h4>
<p>oh wait, maybe not...</p>



<a name="219383964"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219383964" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219383964">(Dec 09 2020 at 19:15)</a>:</h4>
<p>I have officially entered the heisenbug stage</p>



<a name="219384070"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219384070" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219384070">(Dec 09 2020 at 19:16)</a>:</h4>
<p>I managed to place a <code>dbg!</code> statement close enough to the problem that it made the tests pass</p>



<a name="219384315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219384315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219384315">(Dec 09 2020 at 19:18)</a>:</h4>
<p>so yeah, I feel I'm pretty close to the problem here... what's the best way to report this?</p>



<a name="219384467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219384467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219384467">(Dec 09 2020 at 19:19)</a>:</h4>
<p>I have a <code>dbg!</code> that diverges as close as I can get it, and if I place another <code>dbg!</code> above the codeblock in question it passes</p>



<a name="219390736"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219390736" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219390736">(Dec 09 2020 at 20:07)</a>:</h4>
<p>opened a bug report <a href="https://github.com/rust-lang/rust/issues/79865">https://github.com/rust-lang/rust/issues/79865</a></p>



<a name="219391444"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219391444" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Quy Nguyen <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219391444">(Dec 09 2020 at 20:14)</a>:</h4>
<p>If you inhibit inlining, does the problem go away?</p>



<a name="219391458"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219391458" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219391458">(Dec 09 2020 at 20:14)</a>:</h4>
<p>let me check</p>



<a name="219391635"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219391635" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219391635">(Dec 09 2020 at 20:16)</a>:</h4>
<p>well, so I checked something which is probably different from what you mean</p>



<a name="219391668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219391668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219391668">(Dec 09 2020 at 20:16)</a>:</h4>
<p>how do I disable inlining? I tried commenting out the attribute on the function</p>



<a name="219391725"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219391725" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Quy Nguyen <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219391725">(Dec 09 2020 at 20:17)</a>:</h4>
<p><code>#[inline(never)]</code></p>



<a name="219393729"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/219393729" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#219393729">(Dec 09 2020 at 20:33)</a>:</h4>
<p><span class="user-mention silent" data-user-id="132721">Tony Arcieri</span> <a href="#narrow/stream/136281-t-lang.2Fwg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD/near/219384070">said</a>:</p>
<blockquote>
<p>I managed to place a <code>dbg!</code> statement close enough to the problem that it made the tests pass</p>
</blockquote>
<p>I'll take "things a compiler author doesn't want to here for 500", Alex</p>



<a name="240110487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An%20unsafe%20mystery%20with%20SIMD/near/240110487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/An.20unsafe.20mystery.20with.20SIMD.html#240110487">(May 24 2021 at 20:54)</a>:</h4>
<p>...horrifying.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>